﻿@model PhoneBilling.Models.ExtensionEditModel
@{
    ViewBag.Title = "分机编辑";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">
    function changeAreaType() {
        var str = "";
        $(".areaType").each(function () {
            if ($(this).attr("checked") == "checked") {
                str += $(this).attr("id");
            }
        });
        $("#areaType").val(str);
    }
</script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#btnConfirm").ligerButton(
        {
            click: function () {
                $('form').submit();
            }
        });
        $("#date").ligerDateEditor({ showTime: true, label: '安装日期', initValue: '@Model.安装日期.ToString("yyyy-MM-dd HH:mm")', format: "yyyy-MM-dd hh:mm" });
    });
    
</script>
@using (Html.BeginForm())
{
    <div class="extension_edit">
        <div class="system_contain_group">
            <h3 class="title">
                分机信息</h3>
            @Html.HiddenFor(m => m.GroupID)
            @Html.HiddenFor(m => m.SourceGroupID)
            @Html.HiddenFor(m => m.IsNew)
            @Html.HiddenFor(m => m.IsToSearch)
            <div class="system_input_contain">
                @Html.LabelFor(m => m.分机号码)
                @{
    if (Model.IsNew)
    {
                    @Html.TextBoxFor(m => m.分机号码)
                    @Html.ValidationMessageFor(m => m.分机号码, new { style = "color:Red" })
    }
    else
    {
                    @Html.DisplayFor(m => m.分机号码)
                    @Html.HiddenFor(m => m.分机号码)
    }
                }
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.费率)
                @Html.DropDownListFor(m => m.费率, new SelectList(Model.TraiffList, "ID", "Name"), new { style = "input-text" })
                @Html.ValidationMessageFor(m => m.费率, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.收费等级)
                @Html.DropDownListFor(m => m.收费等级, new SelectList(Model.GradeList, "ID", "Name"), new { style = "input-text" })
                @Html.ValidationMessageFor(m => m.收费等级, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.报警限额)
                @Html.TextBoxFor(m => m.报警限额)
                @Html.ValidationMessageFor(m => m.报警限额, new { style = "color:Red" })
                @Html.LabelFor(m => m.月杂费)
                @Html.TextBoxFor(m => m.月杂费)
                @Html.ValidationMessageFor(m => m.月杂费, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.收费话类)
                @Html.HiddenFor(m => m.收费话类, new { id = "areaType" })
                @for (int i = 0; i < Model.话类List.Count; i++)
                {
                    <div class="system_checkbox">
                        @Html.CheckBoxFor(m => m.话类List[i].IsSelected, new { onclick = "changeAreaType()", @class = "areaType", id = Model.话类List[i].ID })
                        @Html.Label(string.Format(" {0} ", Model.话类List[i].Name))
                    </div>
                }
                @Html.ValidationMessageFor(m => m.收费话类, new { style = "color:Red" })
            </div>
        </div>
        <div class="system_contain_group">
            <h3 class="title">
                用户信息</h3>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.用户名)
                @Html.TextBoxFor(m => m.用户名)
                @Html.ValidationMessageFor(m => m.用户名, new { style = "color:Red" })
                @Html.LabelFor(m => m.地址)
                @Html.TextBoxFor(m => m.地址, new { @id = "addr" })
                @Html.ValidationMessageFor(m => m.地址, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.分机功能)
                @Html.TextBoxFor(m => m.分机功能)
                @Html.ValidationMessageFor(m => m.分机功能, new { style = "color:Red" })
                @Html.LabelFor(m => m.机架线号)
                @Html.TextBoxFor(m => m.机架线号)
                @Html.ValidationMessageFor(m => m.机架线号, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.TextBox("安装日期", Model.安装日期, new { @id = "date" })
                @Html.ValidationMessageFor(m => m.安装日期, new { style = "color:Red" })
            </div>
            <div class="system_input_contain">
                @Html.LabelFor(m => m.备注)
                @Html.TextBoxFor(m => m.备注, new { @id = "remark" })
                @Html.ValidationMessageFor(m => m.备注, new { style = "color:Red" })
            </div>
        </div>
        <div class="system_input_contain">
            <input type="button" id="btnConfirm" value="确定" />
        </div>
    </div>
}
